package example.documentbased.mainModule.models
{
	import example.documentbased.mainModule.models.vo.DocumentVO;
	import example.documentbased.mainModule.models.vo.EditorVO;
	
	import mx.collections.ArrayList;
	
	import org.etherframework.common.mediation.IMediationProvider;

	public class MainModel implements IMediationProvider
	{
		private var _editors:ArrayList;
		private var _lastUpdatedEditor:EditorVO;
		
		public function getEditorByDocument(document:DocumentVO):EditorVO
		{
			const arr:Array = _editors.source;
			
			for (var i:int = 0; i < arr.length; i++) 
			{
				if (EditorVO(arr[i]).id == document.editorId)
					return arr[i] as EditorVO;
			}
			return null;
		}

		public function get lastUpdatedEditor():EditorVO { return _lastUpdatedEditor; }
		public function set lastUpdatedEditor(value:EditorVO):void { _lastUpdatedEditor = value; }

		public function get editors():ArrayList { return _editors; }
		public function set editors(value:ArrayList):void { _editors = value; }
	}
}